package IO_study.serializable;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 *  学会进行对象的反序列化,使用对象字节输入流把文件中的对象数据恢复成内存中的java对象
 */
public class ObjectInputStreamDemo {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        // 1.对象反序列化
        ObjectInputStream is = new ObjectInputStream(new FileInputStream("E:\\Project-IDEA\\Study_java\\Java-basic\\src\\IO_study\\serializable\\obj.txt"));

        // 2.调用对象字节输入流的反序列化方法
        Student s = (Student)is.readObject();

        System.out.println(s);
    }
}
